﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;

public partial class loadDeThi : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user"] == null)
            Response.Redirect("dangnhap.aspx");
        if (!IsPostBack)
        {
            loadData();
        }
    }

    public void loadData()
    {
        int mahv = int.Parse(Session["user"].ToString());
        DataTable dsDethi = BaiThiDAL.DanhSachDeThi(mahv);
        if (dsDethi.Rows.Count <= 0)
        {
            mess.Text = "<div class='alert alert-danger'>Không có để thi nào</div>";
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < dsDethi.Rows.Count; i++)
        {
            sb.Append("<tr>");
            sb.Append("<td>").Append(dsDethi.Rows[i]["TenDe"]).Append("</td>");
            sb.Append("<td>").Append(dsDethi.Rows[i]["NgayThi"]).Append("</td>");
            sb.Append("<td>").Append("<input type='submit' value='Bắt đầu' class='btn btn-warning' />").Append("</td>");
        }
        trContent.Text = sb.ToString();
    }
}